home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2b.lha / p4-1.2b / lib / p4_MD.h < prev    next >
C/C++ Source or Header  |  1993-02-06  |  9KB  |  451 lines

  1.  
  2. /* ------------------ Machine Dependent Definitions ---------------- */
  3. /*
  4.         It is important to maintain the order of many of the 
  5.         definitions in this file.
  6. */
  7.  
  8.  
  9. #ifdef TC_2000_TCMP
  10. #define TC_2000
  11. #define TCMP
  12. #endif
  13.  
  14. #if defined(FX8)  ||  defined(FX2800)  || defined(FX2800_SWITCH)
  15. #define ALLIANT
  16. #endif
  17.  
  18. #if defined(FX2800)  || defined(FX2800_SWITCH)
  19. #define VPRINTF
  20. #endif
  21.  
  22.  
  23. #if defined(DELTA) || defined(IPSC860_SOCKETS)
  24. #define IPSC860
  25. #endif
  26.  
  27. #if defined(CM5_SOCKETS)
  28. #define CM5
  29. #endif
  30.  
  31. #if defined(NCUBE_SOCKETS)
  32. #define NCUBE
  33. #endif
  34.  
  35. #if defined(NEXT)  || defined(KSR) ||  defined(IPSC860)  || defined(NCUBE)
  36. #define GLOBAL
  37. #endif
  38.  
  39.  
  40. #if defined(SUN)        || defined(DEC5000)  || \
  41.     defined(NEXT)       || defined(KSR)      || \
  42.     defined(SYMMETRY)   || defined(BALANCE)  || \
  43.     defined(ALLIANT)    || defined(MULTIMAX) ||  defined(CM5) || \
  44.     defined(GP_1000)    || defined(TC_2000)  ||  defined(IBM3090)
  45.  
  46. #define P4BSD
  47.  
  48. #endif
  49.  
  50. #if defined(SUN)        || defined(DEC5000)  || \
  51.     defined(NEXT)       || defined(KSR)      || \
  52.     defined(SYMMETRY)   || defined(BALANCE)  || \
  53.     defined(ALLIANT)    || defined(MULTIMAX) || \
  54.     defined(GP_1000)    || defined(TC_2000)  ||  defined(IBM3090)
  55.  
  56. #define CAN_DO_SETSOCKOPT
  57.  
  58. #endif
  59.  
  60. #if defined(RS6000)          ||                          \
  61.     defined(IPSC860_SOCKETS) ||                          \
  62.     defined(NCUBE_SOCKETS)   ||                          \
  63.     defined(DELTA)           || defined(TITAN)        || \
  64.     defined(SGI)             || defined(CRAY)         || \
  65.     defined(HP)              || defined(SYMMETRY_PTX)
  66.  
  67. #define CAN_DO_SETSOCKOPT
  68.  
  69. #endif
  70.  
  71.  
  72. #if defined(RS6000)       || \
  73.     defined(IPSC860)      ||                          \
  74.     defined(NCUBE)        ||                          \
  75.     defined(DELTA)        || defined(TITAN)        || \
  76.     defined(SGI)          || defined(CRAY)         || \
  77.     defined(HP)           || defined(SYMMETRY_PTX)
  78.  
  79. #define P4SYSV
  80.  
  81. #endif
  82.  
  83.  
  84. #ifdef P4SYSV
  85. #   ifdef NCUBE
  86. #   define SIGNAL_P4 signal
  87. #   else
  88. #   define SIGNAL_P4 sigset
  89. #   endif
  90. #else
  91. #define SIGNAL_P4 signal
  92. #endif
  93.  
  94.  
  95. #ifndef P4BOOL
  96. #define P4BOOL int
  97. #endif
  98.  
  99. #if defined(BALANCE)  ||  defined(FX8)
  100. #define P4VOID int
  101. #else 
  102. #define P4VOID void
  103. #endif
  104.  
  105.  
  106. /*------------------ Encore Multimax ---------------------- */
  107.  
  108.  
  109. #if defined(MULTIMAX)
  110.  
  111. #include <parallel.h>
  112.  
  113. #ifndef LINT
  114. typedef LOCK *MD_lock_t;
  115. #define MD_lock_init(l)  *(l) = spin_create(PAR_UNLOCKED);
  116. #define MD_lock(l)       spin_lock(*(l));
  117. #define MD_unlock(l)     spin_unlock(*(l));
  118. #endif
  119.  
  120. #define GLOBMEMSIZE  (2*1024*1024)
  121. #define CAN_DO_SOCKET_MSGS
  122. #define CAN_DO_XDR
  123. #define CAN_DO_SHMEM_MSGS
  124. #define P4_MAX_MSG_QUEUES 64
  125.  
  126. #endif
  127.  
  128.  
  129. /*------------------ Sequent Balance or Symmetry ---------------------- */
  130.  
  131.  
  132. #if !defined(SYMMETRY) && !defined(SYMMETRY_PTX) && !defined(BALANCE)
  133. #define CAN_HANDLE_SIGSEGV
  134. #endif
  135.  
  136. #if defined(BALANCE) || defined(SYMMETRY) || defined(SYMMETRY_PTX)
  137.  
  138. #include <parallel/parallel.h>
  139.  
  140. typedef slock_t MD_lock_t;
  141.  
  142. #ifndef LINT
  143. #define MD_lock_init(l)  s_init_lock(l);
  144. #define MD_lock(l)       s_lock(l);
  145. #define MD_unlock(l)     s_unlock(l);
  146. #endif
  147. extern char *shmalloc();
  148. #if defined(SYMMETRY_PTX)
  149. extern P4VOID *malloc();
  150. #else
  151. extern char *malloc();
  152. #endif
  153.  
  154. #define GLOBMEMSIZE  (1*1024*1024)
  155. #define CAN_DO_SOCKET_MSGS
  156. #define CAN_DO_XDR
  157. #define CAN_DO_SHMEM_MSGS
  158. #define P4_MAX_MSG_QUEUES 64
  159.  
  160. #endif
  161.  
  162. /*---------------------------- Alliant -------------------------------- */
  163. #if defined(ALLIANT)
  164.  
  165. typedef char MD_lock_t;
  166.  
  167. #ifndef LINT
  168. #define MD_lock_init(l)  initialize_lock(l);
  169. #define MD_lock(l)       lock(l);
  170. #define MD_unlock(l)     unlock(l);
  171. #endif
  172. extern char *valloc();
  173.  
  174. #ifdef FX8
  175. #define GLOBMEMSIZE  (2*1024*1024)    
  176. #else
  177. #define GLOBMEMSIZE  (8*1024*1024)    /* Lots of memory ... use it! */
  178. #endif
  179.  
  180. #define USE_XX_SHMALLOC          /* If not defined uses dumb xx_malloc */
  181.  
  182. #define CAN_DO_SOCKET_MSGS
  183. #define CAN_DO_XDR
  184. #define CAN_DO_SHMEM_MSGS
  185. #define P4_MAX_MSG_QUEUES 64
  186.  
  187. #endif
  188.  
  189. #if defined(FX2800_SWITCH)
  190. #include "sw.h"
  191. #define CAN_DO_SWITCH_MSGS
  192. #endif
  193.  
  194.  
  195. /*---------------------------- Uniprocessors -------------------------- */
  196.  
  197. #if defined(CRAY) || defined(NEXT)
  198. #define GLOBMEMSIZE  (1*1024*1024)
  199. #define CAN_DO_SOCKET_MSGS
  200. #define CAN_DO_XDR
  201. #define P4_MAX_MSG_QUEUES 1
  202. typedef int MD_lock_t;
  203. #define MD_lock_init(l)
  204. #define MD_lock(l)
  205. #define MD_unlock(l)
  206. #endif
  207.  
  208. #if defined(SUN) ||  defined(DEC5000)      \
  209.     || defined(RS6000) || defined(IBM3090) \
  210.     || defined(TITAN) || defined(SGI)      \
  211.     || defined(HP)
  212.  
  213. #define P4_SYSV_SHM_SEGSIZE (1*1024*1024)
  214.  
  215. #if defined(SYSV_IPC)
  216. #define GLOBMEMSIZE  (1*1024*1024)
  217. #define CAN_DO_SOCKET_MSGS
  218. #define CAN_DO_XDR
  219. #define CAN_DO_SHMEM_MSGS
  220. #define USE_XX_SHMALLOC
  221. #define P4_MAX_MSG_QUEUES 4
  222. #define P4_MAX_SYSV_SHMIDS  8
  223. #define P4_MAX_SYSV_SEMIDS  8
  224.  
  225. typedef struct { int semid;  int semnum; }   MD_lock_t;
  226.  
  227. #include <sys/ipc.h>
  228. #include <sys/shm.h>
  229. #include <sys/sem.h>
  230.  
  231. static struct sembuf sem_lock[1] = {
  232.     0, -1, 0
  233. };
  234. static struct sembuf sem_unlock[1] = {
  235.     0, 1, 0
  236. };
  237.  
  238. #else
  239.  
  240. #define GLOBMEMSIZE  (1*1024*1024)
  241. #define CAN_DO_SOCKET_MSGS
  242. #define CAN_DO_XDR
  243. #define P4_MAX_MSG_QUEUES 1
  244. typedef int MD_lock_t;
  245. #define MD_lock_init(l)
  246. #define MD_lock(l)
  247. #define MD_unlock(l)
  248.  
  249. #endif
  250. #endif
  251.  
  252.  
  253. /* following is for POSIX std versions of Unix */
  254. #if defined(SGI)  ||  defined(RS6000)
  255. #include <unistd.h>
  256. #endif
  257.  
  258.  
  259.  
  260. /*---------------------------- IPSC860 Cube --------------------------- */
  261.  
  262. #if defined(IPSC860)
  263.  
  264. #    if defined(DELTA)
  265. #        define P4_MAX_CUBE_MSGS_OUT 5
  266. #    else
  267. #        define P4_MAX_CUBE_MSGS_OUT 5
  268. #    endif
  269.  
  270. #define MD_cube_send  MD_i860_send
  271. #define MD_cube_recv  MD_i860_recv
  272. #define MD_cube_msgs_available  MD_i860_msgs_available
  273.  
  274. typedef int MD_lock_t;
  275.  
  276. #if defined(IPSC860)
  277. #define MYNODE mynode
  278. #endif
  279.  
  280. #ifndef LINT
  281. #define MD_lock_init(l)
  282. #define MD_lock(l)
  283. #define MD_unlock(l)
  284. #endif
  285.  
  286. #define GLOBMEMSIZE  (1*1024*1024)
  287. #define CAN_DO_CUBE_MSGS
  288. #define P4_MAX_MSG_QUEUES 1
  289.  
  290. #define ALL_NODES -1
  291.  
  292. #define NO_TYPE_IPSC     0 
  293. #define ACK_REQUEST_IPSC 1
  294. #define ACK_REPLY_IPSC   2
  295. #define ANY_P4TYPE_IPSC    0x80000007
  296.  
  297. #define NODE_PID 0
  298.  
  299. #if defined(IPSC860_SOCKETS)
  300. #define CAN_DO_SOCKET_MSGS
  301. /*****
  302. #include <CMC/sys/types.h>
  303. #include <CMC/sys/socket.h>
  304. #include <CMC/netinet/in.h>
  305. #include <CMC/netdb.h>
  306. *****/
  307. #include <CMC/ntoh.h>
  308. #endif
  309.  
  310. #endif    
  311.  
  312. /*---------------------------- CM-5 --------------------------- */
  313.  
  314. #if defined(CM5)
  315.  
  316. #include <cm/cmmd.h>
  317. #include <cm/cmmd-io.h>
  318.  
  319. typedef int MD_lock_t;
  320.  
  321. #if defined(CM5)
  322. #define MYNODE CMMD_self_address
  323. #endif
  324.  
  325. #ifndef LINT
  326. #define MD_lock_init(l)
  327. #define MD_lock(l)
  328. #define MD_unlock(l)
  329. #endif
  330.  
  331. #define GLOBMEMSIZE  (1*1024*1024)
  332. #define CAN_DO_CUBE_MSGS
  333. #define P4_MAX_MSG_QUEUES 1
  334.  
  335. #define NO_TYPE_CM5     0 
  336. #define ACK_REQUEST_CM5 1
  337. #define ACK_REPLY_CM5   2
  338. #define ANY_P4TYPE_CM5    CMMD_ANY_TAG
  339.  
  340. #define MD_cube_send  MD_CM5_send
  341. #define MD_cube_recv  MD_CM5_recv
  342. #define MD_cube_msgs_available  MD_CM5_msgs_available
  343.  
  344. #endif    
  345.  
  346.  
  347. /*---------------------------- NCUBE --------------------------- */
  348.  
  349. #if defined(NCUBE)
  350.  
  351. typedef int MD_lock_t;
  352.  
  353. #if defined(NCUBE)
  354. #define MYNODE npid
  355. #endif
  356.  
  357. #ifndef LINT
  358. #define MD_lock_init(l)
  359. #define MD_lock(l)
  360. #define MD_unlock(l)
  361. #endif
  362.  
  363. #define GLOBMEMSIZE  (1*1024*1024)
  364. #define CAN_DO_CUBE_MSGS
  365. #define P4_MAX_MSG_QUEUES 1
  366.  
  367. #define NO_TYPE_NCUBE     0 
  368. #define ACK_REQUEST_NCUBE 1
  369. #define ACK_REPLY_NCUBE   2
  370. #define ANY_P4TYPE_NCUBE  (-1)
  371.  
  372. #define NCUBE_ANY_NODE  (-1)
  373. #define NCUBE_ANY_TAG   (-1)
  374.  
  375. #define MD_cube_send  MD_NCUBE_send
  376. #define MD_cube_recv  MD_NCUBE_recv
  377. #define MD_cube_msgs_available  MD_NCUBE_msgs_available
  378.  
  379. #endif    
  380.  
  381. /*----------------   KSR             -------------------------*/
  382. #if defined(KSR)
  383. #include <sys/mman.h>
  384. #include <pthread.h>
  385.  
  386. #define USE_XX_SHMALLOC
  387. #define GLOBMEMSIZE  (8*1024*1024)
  388. #define P4_MAX_MSG_QUEUES 32
  389. #define CAN_DO_SOCKET_MSGS
  390. #define CAN_DO_XDR
  391. #define CAN_DO_SHMEM_MSGS
  392.  
  393. #define MD_lock_t       msemaphore
  394. #define MD_lock_init(l) msem_init(l, MSEM_UNLOCKED)
  395. #define MD_lock(l)      msem_lock(l, 0)
  396. #define MD_unlock(l )   msem_unlock(l, 0)
  397.  
  398. #endif
  399.  
  400.  
  401.  
  402. /*------------------ Butterfly TC-2000/GP-1000 -------------- */
  403. #if defined(TC_2000)  ||  defined(GP_1000)
  404. #include <mach.h>    
  405. #include <sys/cluster.h>
  406. #include <sys/kern_return.h>
  407. #include <heap.h>
  408.  
  409. char *xx_malloc();
  410. P4VOID MD_malloc_hint();
  411.  
  412. #ifdef MALLOC_STATS
  413. static unsigned int allocated = 0;
  414. #endif
  415.  
  416. #define MD_lock_t       int
  417. #ifndef LINT
  418. #define MD_lock_init(l) simple_unlock(l)
  419. #define MD_lock(l)      simple_lock(l)
  420. #define MD_unlock(l)    simple_unlock(l)
  421. #endif
  422.  
  423. #define GLOBMEMSIZE  (1*1024*1024)
  424. #define CAN_DO_SOCKET_MSGS
  425. #define CAN_DO_XDR
  426. #define CAN_DO_SHMEM_MSGS
  427. #define P4_MAX_MSG_QUEUES 128
  428.  
  429. #endif
  430.  
  431. #ifdef TCMP
  432. #define CAN_DO_TCMP_MSGS
  433. /* #include </Net/sparky/sparky1/lusk/lepido/tcmp/tcmp.h> */
  434. #include </usr/bbnm/tcmp/tcmp.h>
  435. #endif
  436.  
  437. /* ----------------- Can be made machine dependent -------------------*/
  438.  
  439. typedef unsigned long p4_usc_time_t;
  440.  
  441.  
  442. extern P4VOID exit();
  443.  
  444. #define P4_MAXPROCS 128
  445.  
  446. #ifndef LINT
  447. #define p4_malloc malloc
  448. #define p4_free free
  449. #define p4_clock MD_clock
  450. #endif
  451.